package day19;

import java.util.Arrays;

public class Homework5 {
    public static void main(String[] args) {
        int a[]={6,3,8,2,9,1};
        for (int i=0;i<a.length-1;i++){
            for (int j=0;j<a.length-1-i;j++){
                if (a[j]>a[j+1]){
                    a[j]=a[j]^a[j+1];
                    a[j+1]=a[j]^a[j+1];
                    a[j]=a[j]^a[j+1];
                }
            }
        }
        System.out.println("排序过后："+Arrays.toString(a));
    }
}


class ThreadTest{
    int j=0;
    public void add(){
       j++;
       String name=Thread.currentThread().getName();
       System.out.println(name+"运行结果："+j);
    }
    public void minus(){
        j--;
        String name=Thread.currentThread().getName();
        System.out.println(name+"运行结果："+j);
    }

    public static void main(String[] args) {
        ThreadTest tt=new ThreadTest();
        new Thread(()->{
            for (int i=0;i<5;i++){
                tt.add();
            }
        },"线程1").start();

        new Thread(()->{
            for (int i=0;i<5;i++){
                tt.add();
            }
        },"线程2").start();
        new Thread(()->{
            for (int i=0;i<5;i++){
                tt.minus();
            }
        },"线程3").start();
        new Thread(()->{
            for (int i=0;i<5;i++){
                tt.minus();
            }
        },"线程4").start();
    }
}

class Change {
    public static void main(String[] args) {
        char[][] matrix = {
                {'a', 'b', 'c', 'd', 'e'},
                {'f', 'g', 'h', 'i', 'j'},
                {'k', 'l', 'm', 'n', 'o'},
                {'p', 'q', 'r', 's', 't'},
                {'u', 'v', 'w', 'x', 'y'}
        };

        print(matrix);
    }
    public static void print(char[][] matrix) {
        for (int i = 0; i < matrix.length; i++) {
            for (int j = 0; j < matrix[i].length; j++) {
                char outputChar = matrix[i][j];
                if ((i == 1 && j == 1) || (i == 2 && j == 2) || (i == 3 && j == 3)) {
                    outputChar = Character.toUpperCase(outputChar);
                }
                System.out.print(outputChar + "\t");
            }
            System.out.println();
        }
    }
}